/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * articulos_sie_almacen_movi_extras.java
 *
 * Created on 8/08/2011, 12:40:25 PM
 */

package sie_invdis;


import java.sql.*;
import javax.swing.*;

import javax.swing.JOptionPane;
import javax.swing.JTable;
import javax.swing.JTable.*;
import java.awt.*;
import java.util.Date;
import java.util.Calendar;
import java.text.SimpleDateFormat;
import java.text.ParseException;
import java.text.*;


/**
 *
 * @author Michelle
 */
public class articulos_sie_almacen_movi_extras extends javax.swing.JFrame {

     private int fidtienda=0,controlcombo=0,controlcombomovi=0;
    bd_conexion x = new bd_conexion() ;
    //se creaa la variable resultset
    ResultSet rs = null;
    private int buscamp=1;
    private int opbuscamp=2;
    private int control_enter=0;
    private javax.swing.table.DefaultTableModel jtable_modelo_movextras;
    private JTable jtable_tiendas;
    private SimpleDateFormat formateador = new SimpleDateFormat("dd-MM-yyyy");
    private SimpleDateFormat formateadoresta = new SimpleDateFormat("yyyy-MM-dd");

    /** Creates new form articulos_sie_almacen_movi_extras */
    public articulos_sie_almacen_movi_extras() {
        this.iniciar_modelo_movextra();
        initComponents();
    
     this.jtf_busqueda.requestFocus();
      
     
     if (variables_global.getnivelusu()==3)
            {
                 this.jcbx_tiendas.addItem(variables_global.getidtiendami()+":"+variables_global.getidtiendamidescribe());
                 this.carga_datos_movextras(0,"0",String.valueOf(variables_global.getidtiendami()));
                  this.buttonGroup1.setSelected(jrbtn_general.getModel(), true);
            }
     if (variables_global.getnivelusu()<3)
            {
          if(JOptionPane.showConfirmDialog(null, "Desea Cargar Mov?")==0) {
                this.carga_datos_movextras(0,"0",String.valueOf(variables_global.getidtiendami()));
                  this.buttonGroup1.setSelected(jrbtn_enproceso.getModel(), true);
            }

            }
        this.loadcombo();
        this.loadcombo_movimientos();
        controlcombo=1;
        controlcombomovi=1;
    }
private void iniciar_modelo_movextra()
        {
            jtable_modelo_movextras=new javax.swing.table.DefaultTableModel();//Creo el modelo
            jtable_modelo_movextras.addColumn("<html><b>Moviemiento</b></html>");
            jtable_modelo_movextras.addColumn("<html><b>Status</b></html>");
            jtable_modelo_movextras.addColumn("<html><b>T. Origen</b></html>");
            jtable_modelo_movextras.addColumn("<html><b>E. Elaboro</b></html>");
            jtable_modelo_movextras.addColumn("<html><b>Fecha</b></html>");
            jtable_modelo_movextras.addColumn("<html><b>Dias Trans.</b></html>");
            jtable_modelo_movextras.addColumn("<html><b>Piezas</b></html>");
            jtable_modelo_movextras.addColumn("<html><b>Precio</b></html>");
            jtable_modelo_movextras.addColumn("<html><b>Observaciones</b></html>");
        }

private void carga_datos_movextras(int opbus,String tbusca,String idtienda)
{
       String fechacat = "",fechaorigen="",fechaentrega="";
       DecimalFormat miformat = new DecimalFormat("###,###,###,###");
       Object[] fnewRow = new Object[9];
       this.LimpiarJTable();
       String arreglo_idtie[]=null;
       String cadenasql="select * from x1sieuno_articulo_almacen_movextras("+opbus+","+idtienda+",'"+tbusca+"') as (idmovi integer,idniv1 integer,totalventa real,idstatus integer,observa text,idtipomov integer,fecha date,hora time,idempleado integer,fechames text,cantidad real,importeprecio real,importecosto double precision,nombreempleado text,statusdescrip text,movimientoextradescribe text,diastras integer);";
       //invoco al metodo que trae el recordset de datos
       System.out.println(cadenasql);

        try
         {
            rs = x.sieuno_executediversosv2(cadenasql,variables_global.getconexiongral());
            while (rs.next())
                {
                    fechaentrega="";
                    arreglo_idtie=rs.getString ("statusdescrip").toString().split(":");
                    fnewRow[0]=rs.getString("idtipomov")+":"+rs.getString("movimientoextradescribe");
                    fnewRow[1]=rs.getString("idmovi")+":"+arreglo_idtie[1];
                    fnewRow[2]=arreglo_idtie[2]+":"+arreglo_idtie[0];
                    fnewRow[3]=rs.getString("nombreempleado");
                    fechaorigen="<html>"+this.fechaeuropea(rs.getString("fecha"))+":<br>"+DiaSemana(this.fechaeuropea(rs.getString ("fecha")))+" "+rs.getString ("hora").substring(0, 5)+"</html>";
                    fnewRow[4]=fechaorigen;
                    fnewRow[5]=rs.getString("diastras");
                    fnewRow[6]=miformat.format(rs.getFloat("cantidad"));
                    fnewRow[7]=miformat.format(rs.getFloat("importeprecio"));
                    fnewRow[8]=rs.getString("observa");
                   jtable_modelo_movextras.addRow(fnewRow);
                }
        }
        catch(Exception e)
            {
                System.out.println(e.getMessage());
            }
       this.cambiartamanofilastras();
       this.registrosobtenidos();
}



void cambiartamanofilastras()
    {
     //limpiar la tabla
       int numerofilas=this.jtable_modelo_movextras.getRowCount();
       for(int i = 0 ;i < numerofilas; i++)
               {
                    jt_almamoviextras.setRowHeight(i, 30);
               }
    }
private String  fechaeuropea(String fecha) {
       //resibe cadena de fecha en formato americano yyyy-MM-dd
       java.util.Date fechaestaeuropa=null;
       SimpleDateFormat formateadorestaeuropa = new SimpleDateFormat("dd-MM-yyyy");
       String cadenafecha="";
        try
         {
          fechaestaeuropa = formateadoresta.parse(fecha);
         }
        catch (ParseException e)
          {
             //Error, la cadena de texto no se puede convertir en fecha.
          }
       cadenafecha= formateadorestaeuropa.format(fechaestaeuropa);
       return cadenafecha;
    }
private String DiaSemana(String fe) {
       String dia = "";
       java.util.Date fecha=null;
         try
           {
             fecha = formateador.parse(fe);
           }
        catch (ParseException e)
            {
            //Error, la cadena de texto no se puede convertir en fecha.
            }
        Calendar cal= Calendar.getInstance();
        cal.setTime(fecha);
        //ojo para establecer o recetear cada parte de la fecha por separado
        //cal.set(Calendar.YEAR, fecha.getYear());
        //cal.set(Calendar.MONTH, fecha.getMonth());
        //cal.set(Calendar.DAY_OF_MONTH, fecha.getDay());
        int diaInt = cal.get(Calendar.DAY_OF_WEEK);
        switch (diaInt) {
            case 1:
                dia = "Domingo";
                break;
            case 2:
                dia = "Lunes";
                break;
            case 3:
                dia = "Martes";
                break;
            case 4:
                dia = "Miercoles";
                break;
            case 5:
                dia = "Jueves";
                break;
            case 6:
                dia = "Viernes";
                break;
            case 7:
                dia = "Sabado";
                break;

        }
        return dia;
    }

void LimpiarJTable()
 {
     //limpiar la tabla
    while(jtable_modelo_movextras.getRowCount()>0)jtable_modelo_movextras.removeRow(0);
 }

 private String  fechaamericana(String fecha) {

         //resibe cadena de fecha en formato americano dd-MM-yyyy
        java.util.Date fechaestaeuropa=null;
       SimpleDateFormat formateadorestaamericano = new SimpleDateFormat("yyyy-MM-dd");
       String cadenafecha="";
        try
         {
          fechaestaeuropa = formateador.parse(fecha);
         }
        catch (ParseException e)
          {
             //Error, la cadena de texto no se puede convertir en fecha.
          }
       cadenafecha= formateadorestaamericano.format(fechaestaeuropa);
       return cadenafecha;

    }
 
private void loadcombo(){
        
        this.jcbx_tiendas.addItem("0:Selecciones Una Tienda");
        try
            {
               rs = x.sieuno_executediversosv2("select * from x1distribucion_tiendas_activas(3,'','') as (tie_descri character varying(35),tie_id integer,tie_desesque character varying(25),idclie character varying(12));",variables_global.getconexiongral());
               while (rs.next())
                    {
                          this.jcbx_tiendas.addItem(rs.getString("tie_id")+":"+rs.getString("tie_descri"));
                    }
            }
            catch(Exception e)
            {
                System.out.println(e.getMessage());
            }
        try
            {
               rs = x.sieuno_executediversosv2("select * from x1distribucion_tiendas_activas(4,'','') as (tie_descri character varying(35),tie_id integer,tie_desesque character varying(25),idclie character varying(12));",variables_global.getconexiongral());
               while (rs.next())
                    {
                          this.jcbx_tiendas.addItem(rs.getString("tie_id")+":"+rs.getString("tie_descri"));
                    }
            }
            catch(Exception e)
            {
                System.out.println(e.getMessage());
            }
    }
private void loadcombo_movimientos()
{

       this.jcbx_mobimientos.addItem("0"+":"+"Elegir Movimiento");
       try
         {
            rs = x.sieuno_executediversosv2("select * from x1sieuno_articulo_almacen_entysalcatalogo() as (idcattipo integer,nombre text,descripcion text,operador character varying(1));",variables_global.getconexiongral());
            while (rs.next())
                {
                            this.jcbx_mobimientos.addItem(rs.getString("idcattipo")+":"+rs.getString("descripcion").toUpperCase());
                }

        }
        catch(Exception e)
        {
            System.out.println(e.getMessage());
        }
}
void registrosobtenidos()
 {
     //limpiar la tabla
    this.jlbl_cantidadregistros.setText(String.valueOf(this.jtable_modelo_movextras.getRowCount()));
    this.jlbl_textobuscado.setText(this.jtf_busqueda.getText().toUpperCase().trim());
 }

 private void dioclick(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
         int fila = jt_almamoviextras.getSelectedRow();
         String idcadena[]=this.jt_almamoviextras.getValueAt(fila, 1).toString().split(":");
         String idcadenatie[]=this.jt_almamoviextras.getValueAt(fila, 2).toString().split(":");

         //JFrame mainFrame = Sie_invdisApp.getApplication().getMainFrame();
         articulos_sie_almacen_movi_extras_detalle fasamed=new articulos_sie_almacen_movi_extras_detalle(idcadena[0],idcadenatie[0]);
         fasamed.pack();
         fasamed.setVisible(true);
    }
private void jt_almamoviextrasMouseClicked(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
    }
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        jPanel1 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jt_almamoviextras = new javax.swing.JTable()
        {
            public boolean isCellEditable(int rowIndex, int mColIndex) {
                return false;
            }
        }
        ;
        jlbl_textobuscado = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jlbl_cantidadregistros = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        jcbx_tiendas = new javax.swing.JComboBox();
        jLabel4 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jtf_busqueda = new javax.swing.JTextField();
        jbtn_busqueda = new javax.swing.JButton();
        jrbtn_folio = new javax.swing.JRadioButton();
        jrbtn_obserdocto = new javax.swing.JRadioButton();
        jrbtn_enproceso = new javax.swing.JRadioButton();
        jrbtn_general = new javax.swing.JRadioButton();
        jrbtn_idstatus = new javax.swing.JRadioButton();
        jrbtn_idmoviextra = new javax.swing.JRadioButton();
        jcbx_mobimientos = new javax.swing.JComboBox();
        jLabel7 = new javax.swing.JLabel();
        jrbtn_general1 = new javax.swing.JRadioButton();
        jPanel3 = new javax.swing.JPanel();
        jButton1 = new javax.swing.JButton();
        jbtn_estadistica = new javax.swing.JButton();
        jbtn_estadistica1 = new javax.swing.JButton();
        jbtn_estadistica2 = new javax.swing.JButton();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jmni_salir = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jmni_escape = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(sie_invdis.Sie_invdisApp.class).getContext().getResourceMap(articulos_sie_almacen_movi_extras.class);
        setTitle(resourceMap.getString("Form.title")); // NOI18N
        setName("Form"); // NOI18N

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel1.border.title"))); // NOI18N
        jPanel1.setName("jPanel1"); // NOI18N

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        jt_almamoviextras.setModel(this.jtable_modelo_movextras);
        jt_almamoviextras.setName("jt_almamoviextras"); // NOI18N
        jt_almamoviextras.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jt_almamoviextrasMouseClicked(evt);
                if(evt.getClickCount() >= 2)
                {
                    dioclick(evt);
                    //System.out.println(" double click" );

                }
            }
        });
        jScrollPane1.setViewportView(jt_almamoviextras);

        jlbl_textobuscado.setFont(resourceMap.getFont("jlbl_textobuscado.font")); // NOI18N
        jlbl_textobuscado.setName("jlbl_textobuscado"); // NOI18N

        jLabel3.setFont(resourceMap.getFont("jLabel3.font")); // NOI18N
        jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
        jLabel3.setName("jLabel3"); // NOI18N

        jlbl_cantidadregistros.setFont(resourceMap.getFont("jlbl_cantidadregistros.font")); // NOI18N
        jlbl_cantidadregistros.setText(resourceMap.getString("jlbl_cantidadregistros.text")); // NOI18N
        jlbl_cantidadregistros.setName("jlbl_cantidadregistros"); // NOI18N

        jLabel5.setFont(resourceMap.getFont("jLabel5.font")); // NOI18N
        jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N
        jLabel5.setName("jLabel5"); // NOI18N

        jLabel6.setText(resourceMap.getString("jLabel6.text")); // NOI18N
        jLabel6.setName("jLabel6"); // NOI18N

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(jLabel6)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jlbl_textobuscado, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel3)
                .addGap(18, 18, 18)
                .addComponent(jlbl_cantidadregistros, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel5)
                .addContainerGap(637, Short.MAX_VALUE))
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 990, Short.MAX_VALUE)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6)
                    .addComponent(jLabel5)
                    .addComponent(jlbl_cantidadregistros)
                    .addComponent(jLabel3)
                    .addComponent(jlbl_textobuscado))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 418, Short.MAX_VALUE)
                .addContainerGap())
        );

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel2.border.title"))); // NOI18N
        jPanel2.setName("jPanel2"); // NOI18N

        jcbx_tiendas.setToolTipText(resourceMap.getString("jcbx_tiendas.toolTipText")); // NOI18N
        jcbx_tiendas.setName("jcbx_tiendas"); // NOI18N
        jcbx_tiendas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcbx_tiendasActionPerformed(evt);
            }
        });

        jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
        jLabel4.setName("jLabel4"); // NOI18N

        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N

        jtf_busqueda.setToolTipText(resourceMap.getString("jtf_busqueda.toolTipText")); // NOI18N
        jtf_busqueda.setName("jtf_busqueda"); // NOI18N
        jtf_busqueda.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_busquedaActionPerformed(evt);
            }
        });

        jbtn_busqueda.setIcon(resourceMap.getIcon("jbtn_busqueda.icon")); // NOI18N
        jbtn_busqueda.setText(resourceMap.getString("jbtn_busqueda.text")); // NOI18N
        jbtn_busqueda.setToolTipText(resourceMap.getString("jbtn_busqueda.toolTipText")); // NOI18N
        jbtn_busqueda.setName("jbtn_busqueda"); // NOI18N
        jbtn_busqueda.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_busquedaActionPerformed(evt);
            }
        });

        buttonGroup1.add(jrbtn_folio);
        jrbtn_folio.setText(resourceMap.getString("jrbtn_folio.text")); // NOI18N
        jrbtn_folio.setToolTipText(resourceMap.getString("jrbtn_folio.toolTipText")); // NOI18N
        jrbtn_folio.setActionCommand(resourceMap.getString("jrbtn_folio.actionCommand")); // NOI18N
        jrbtn_folio.setName("jrbtn_folio"); // NOI18N
        jrbtn_folio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jrbtn_folioActionPerformed(evt);
            }
        });

        buttonGroup1.add(jrbtn_obserdocto);
        jrbtn_obserdocto.setText(resourceMap.getString("jrbtn_obserdocto.text")); // NOI18N
        jrbtn_obserdocto.setToolTipText(resourceMap.getString("jrbtn_obserdocto.toolTipText")); // NOI18N
        jrbtn_obserdocto.setActionCommand(resourceMap.getString("jrbtn_obserdocto.actionCommand")); // NOI18N
        jrbtn_obserdocto.setName("jrbtn_obserdocto"); // NOI18N
        jrbtn_obserdocto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jrbtn_obserdoctoActionPerformed(evt);
            }
        });

        buttonGroup1.add(jrbtn_enproceso);
        jrbtn_enproceso.setText(resourceMap.getString("jrbtn_enproceso.text")); // NOI18N
        jrbtn_enproceso.setActionCommand(resourceMap.getString("jrbtn_enproceso.actionCommand")); // NOI18N
        jrbtn_enproceso.setName("jrbtn_enproceso"); // NOI18N
        jrbtn_enproceso.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jrbtn_enprocesoActionPerformed(evt);
            }
        });

        buttonGroup1.add(jrbtn_general);
        jrbtn_general.setText(resourceMap.getString("jrbtn_general.text")); // NOI18N
        jrbtn_general.setActionCommand(resourceMap.getString("jrbtn_general.actionCommand")); // NOI18N
        jrbtn_general.setName("jrbtn_general"); // NOI18N
        jrbtn_general.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jrbtn_generalActionPerformed(evt);
            }
        });

        buttonGroup1.add(jrbtn_idstatus);
        jrbtn_idstatus.setText(resourceMap.getString("jrbtn_idstatus.text")); // NOI18N
        jrbtn_idstatus.setToolTipText(resourceMap.getString("jrbtn_idstatus.toolTipText")); // NOI18N
        jrbtn_idstatus.setActionCommand(resourceMap.getString("jrbtn_idstatus.actionCommand")); // NOI18N
        jrbtn_idstatus.setName("jrbtn_idstatus"); // NOI18N
        jrbtn_idstatus.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jrbtn_idstatusActionPerformed(evt);
            }
        });

        buttonGroup1.add(jrbtn_idmoviextra);
        jrbtn_idmoviextra.setText(resourceMap.getString("jrbtn_idmoviextra.text")); // NOI18N
        jrbtn_idmoviextra.setToolTipText(resourceMap.getString("jrbtn_idmoviextra.toolTipText")); // NOI18N
        jrbtn_idmoviextra.setActionCommand(resourceMap.getString("jrbtn_idmoviextra.actionCommand")); // NOI18N
        jrbtn_idmoviextra.setName("jrbtn_idmoviextra"); // NOI18N
        jrbtn_idmoviextra.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jrbtn_idmoviextraActionPerformed(evt);
            }
        });

        jcbx_mobimientos.setToolTipText(resourceMap.getString("jcbx_mobimientos.toolTipText")); // NOI18N
        jcbx_mobimientos.setName("jcbx_mobimientos"); // NOI18N
        jcbx_mobimientos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcbx_mobimientosActionPerformed(evt);
            }
        });

        jLabel7.setText(resourceMap.getString("jLabel7.text")); // NOI18N
        jLabel7.setName("jLabel7"); // NOI18N

        buttonGroup1.add(jrbtn_general1);
        jrbtn_general1.setText(resourceMap.getString("jrbtn_general1.text")); // NOI18N
        jrbtn_general1.setToolTipText(resourceMap.getString("jrbtn_general1.toolTipText")); // NOI18N
        jrbtn_general1.setActionCommand(resourceMap.getString("jrbtn_general1.actionCommand")); // NOI18N
        jrbtn_general1.setName("jrbtn_general1"); // NOI18N
        jrbtn_general1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jrbtn_general1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(166, 166, 166)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jLabel2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jtf_busqueda, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jbtn_busqueda)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel4)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jcbx_tiendas, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabel7)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jcbx_mobimientos, javax.swing.GroupLayout.PREFERRED_SIZE, 236, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jrbtn_folio, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jrbtn_enproceso)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jrbtn_obserdocto)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jrbtn_idstatus)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jrbtn_idmoviextra)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jrbtn_general)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jrbtn_general1)))
                .addContainerGap(15, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(jtf_busqueda, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jbtn_busqueda)
                    .addComponent(jLabel4)
                    .addComponent(jcbx_tiendas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel7)
                    .addComponent(jcbx_mobimientos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jrbtn_general)
                    .addComponent(jrbtn_folio, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jrbtn_enproceso)
                    .addComponent(jrbtn_obserdocto, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jrbtn_idstatus)
                    .addComponent(jrbtn_idmoviextra)
                    .addComponent(jrbtn_general1)))
        );

        jPanel3.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jPanel3.setName("jPanel3"); // NOI18N

        jButton1.setIcon(resourceMap.getIcon("jButton1.icon")); // NOI18N
        jButton1.setText(resourceMap.getString("jButton1.text")); // NOI18N
        jButton1.setName("jButton1"); // NOI18N
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jbtn_estadistica.setIcon(resourceMap.getIcon("jbtn_estadistica.icon")); // NOI18N
        jbtn_estadistica.setText(resourceMap.getString("jbtn_estadistica.text")); // NOI18N
        jbtn_estadistica.setToolTipText(resourceMap.getString("jbtn_estadistica.toolTipText")); // NOI18N
        jbtn_estadistica.setName("jbtn_estadistica"); // NOI18N
        jbtn_estadistica.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_estadisticaActionPerformed(evt);
            }
        });

        jbtn_estadistica1.setText(resourceMap.getString("jbtn_estadistica1.text")); // NOI18N
        jbtn_estadistica1.setToolTipText(resourceMap.getString("jbtn_estadistica1.toolTipText")); // NOI18N
        jbtn_estadistica1.setName("jbtn_estadistica1"); // NOI18N
        jbtn_estadistica1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_estadistica1ActionPerformed(evt);
            }
        });

        jbtn_estadistica2.setText(resourceMap.getString("jbtn_estadistica2.text")); // NOI18N
        jbtn_estadistica2.setToolTipText(resourceMap.getString("jbtn_estadistica2.toolTipText")); // NOI18N
        jbtn_estadistica2.setName("jbtn_estadistica2"); // NOI18N
        jbtn_estadistica2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_estadistica2ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addComponent(jbtn_estadistica)
                .addGap(18, 18, 18)
                .addComponent(jbtn_estadistica1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jbtn_estadistica2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 560, Short.MAX_VALUE)
                .addComponent(jButton1)
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(jButton1)
                .addComponent(jbtn_estadistica)
                .addComponent(jbtn_estadistica1)
                .addComponent(jbtn_estadistica2))
        );

        jMenuBar1.setName("jMenuBar1"); // NOI18N

        jMenu1.setText(resourceMap.getString("jMenu1.text")); // NOI18N
        jMenu1.setName("jMenu1"); // NOI18N

        jmni_salir.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.ALT_MASK));
        jmni_salir.setIcon(resourceMap.getIcon("jmni_salir.icon")); // NOI18N
        jmni_salir.setText(resourceMap.getString("jmni_salir.text")); // NOI18N
        jmni_salir.setName("jmni_salir"); // NOI18N
        jmni_salir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmni_salirActionPerformed(evt);
            }
        });
        jMenu1.add(jmni_salir);

        jMenuBar1.add(jMenu1);

        jMenu2.setText(resourceMap.getString("jMenu2.text")); // NOI18N
        jMenu2.setName("jMenu2"); // NOI18N

        jmni_escape.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ESCAPE, 0));
        jmni_escape.setText(resourceMap.getString("jmni_escape.text")); // NOI18N
        jmni_escape.setName("jmni_escape"); // NOI18N
        jmni_escape.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmni_escapeActionPerformed(evt);
            }
        });
        jMenu2.add(jmni_escape);

        jMenuBar1.add(jMenu2);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(41, 41, 41))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jcbx_tiendasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbx_tiendasActionPerformed
        // TODO add your handling code here:
        if (controlcombo > 0 ) {
            if(JOptionPane.showConfirmDialog(null, "Estan Correctos sus Datos?")==0) {
                String arreglo_idtie[]=null;
                arreglo_idtie=this.jcbx_tiendas.getSelectedItem().toString().split(":");
                this.carga_datos_movextras(buscamp,this.jtf_busqueda.getText().toUpperCase(),arreglo_idtie[0]);
                
            }
        }


        //this.jtfpruebados.setText(jtable_tiendas.getValueAt(indeceta, 0).toString());
}//GEN-LAST:event_jcbx_tiendasActionPerformed

    private void jtf_busquedaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_busquedaActionPerformed
        // TODO add your handling code here:
        this.jbtn_busquedaActionPerformed(evt);
}//GEN-LAST:event_jtf_busquedaActionPerformed

    private void jbtn_busquedaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_busquedaActionPerformed
        // TODO add your handling code here:
        String fechaa="",textob="";
         if((buscamp==13)||(buscamp==14))
            {
             fechaa=this.fechaamericana(this.jtf_busqueda.getText().trim().replace("/", "-"));
             textob=fechaa;
            }
         else
            {
                textob=this.jtf_busqueda.getText().trim().toUpperCase();
            }
        if(JOptionPane.showConfirmDialog(null, "Estan correcto sus Datos?")==0) {
            this.carga_datos_movextras(buscamp,textob,String.valueOf(variables_global.getidtiendami()));
            //  this.cambiartamanofilas();
        }
}//GEN-LAST:event_jbtn_busquedaActionPerformed

    private void jrbtn_folioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrbtn_folioActionPerformed
        // TODO add your handling code here:
        buscamp=Integer.parseInt(evt.getActionCommand().toString());
}//GEN-LAST:event_jrbtn_folioActionPerformed

    private void jrbtn_obserdoctoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrbtn_obserdoctoActionPerformed
        // TODO add your handling code here:
        buscamp=Integer.parseInt(evt.getActionCommand().toString());
}//GEN-LAST:event_jrbtn_obserdoctoActionPerformed

    private void jrbtn_enprocesoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrbtn_enprocesoActionPerformed
        // TODO add your handling code here:
        buscamp=Integer.parseInt(evt.getActionCommand().toString());
}//GEN-LAST:event_jrbtn_enprocesoActionPerformed

    private void jrbtn_generalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrbtn_generalActionPerformed
        // TODO add your handling code here:
        buscamp=Integer.parseInt(evt.getActionCommand().toString());
}//GEN-LAST:event_jrbtn_generalActionPerformed

    private void jrbtn_idstatusActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrbtn_idstatusActionPerformed
        // TODO add your handling code here:
        buscamp=Integer.parseInt(evt.getActionCommand().toString());
}//GEN-LAST:event_jrbtn_idstatusActionPerformed

    private void jmni_salirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_salirActionPerformed
        // TODO add your handling code here:
       if(JOptionPane.showConfirmDialog(null, "Desea Salir?")==0) {
             this.dispose();
        }
    }//GEN-LAST:event_jmni_salirActionPerformed

    private void jmni_escapeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_escapeActionPerformed
        // TODO add your handling code here:
        this.jmni_salirActionPerformed(evt);
    }//GEN-LAST:event_jmni_escapeActionPerformed

    private void jrbtn_idmoviextraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrbtn_idmoviextraActionPerformed
        // TODO add your handling code here:
        buscamp=Integer.parseInt(evt.getActionCommand().toString());
}//GEN-LAST:event_jrbtn_idmoviextraActionPerformed

    private void jcbx_mobimientosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbx_mobimientosActionPerformed
        // TODO add your handling code here:
         if (controlcombomovi > 0 ) {

                String arreglo_idmovi[]=null;
                arreglo_idmovi=this.jcbx_mobimientos.getSelectedItem().toString().split(":");
                this.jtf_busqueda.setText(arreglo_idmovi[0]);
                buscamp=5;
                this.buttonGroup1.setSelected(jrbtn_idmoviextra.getModel(), true);
                this.jtf_busquedaActionPerformed(evt);
        }
}//GEN-LAST:event_jcbx_mobimientosActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        // TODO add your handling code here:
        //x.cierraConexion();   // TODO add your handling code here:
        this.dispose();
}//GEN-LAST:event_jButton1ActionPerformed

    private void jbtn_estadisticaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_estadisticaActionPerformed
        // TODO add your handling code here:
 if(variables_global.getnivelusu()<3)
            {
                articulos_sie_almacen_movi_estadis fasame=new articulos_sie_almacen_movi_estadis();
                fasame.pack();
                fasame.setVisible(true);
            }
         else
            {
               JOptionPane.showMessageDialog(null,"Opcion no disponible en su Perfil:", "Sistema Integral(Grafica cortes del dia) : Ayuda",1);
            }

    }//GEN-LAST:event_jbtn_estadisticaActionPerformed

    private void jrbtn_general1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrbtn_general1ActionPerformed
        // TODO add your handling code here:
        buscamp=Integer.parseInt(evt.getActionCommand().toString());
    }//GEN-LAST:event_jrbtn_general1ActionPerformed

    private void jbtn_estadistica1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_estadistica1ActionPerformed
        // TODO add your handling code here:
        articulos_sie_almacen_movi_reclasifalta fasamra=new articulos_sie_almacen_movi_reclasifalta(1);
        fasamra.pack();
        fasamra.setVisible(true);
    }//GEN-LAST:event_jbtn_estadistica1ActionPerformed

    private void jbtn_estadistica2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_estadistica2ActionPerformed
        // TODO add your handling code here:
         articulos_sie_almacen_movi_reclasifalta fasamra=new articulos_sie_almacen_movi_reclasifalta(2);
        fasamra.pack();
        fasamra.setVisible(true);
    }//GEN-LAST:event_jbtn_estadistica2ActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new articulos_sie_almacen_movi_extras().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JButton jbtn_busqueda;
    private javax.swing.JButton jbtn_estadistica;
    private javax.swing.JButton jbtn_estadistica1;
    private javax.swing.JButton jbtn_estadistica2;
    private javax.swing.JComboBox jcbx_mobimientos;
    private javax.swing.JComboBox jcbx_tiendas;
    private javax.swing.JLabel jlbl_cantidadregistros;
    private javax.swing.JLabel jlbl_textobuscado;
    private javax.swing.JMenuItem jmni_escape;
    private javax.swing.JMenuItem jmni_salir;
    private javax.swing.JRadioButton jrbtn_enproceso;
    private javax.swing.JRadioButton jrbtn_folio;
    private javax.swing.JRadioButton jrbtn_general;
    private javax.swing.JRadioButton jrbtn_general1;
    private javax.swing.JRadioButton jrbtn_idmoviextra;
    private javax.swing.JRadioButton jrbtn_idstatus;
    private javax.swing.JRadioButton jrbtn_obserdocto;
    private javax.swing.JTable jt_almamoviextras;
    private javax.swing.JTextField jtf_busqueda;
    // End of variables declaration//GEN-END:variables

}
